import { createRouter, createWebHistory } from "vue-router";


const router = createRouter({
    history: createWebHistory(),
    routes: [
        {
            path: '/',
            redirect: '/home'
        },
        {
            path: '/',
            name: 'rootHome',
            component: () => import('../views/home.vue'),
            children: [
                {
                    path: '/home',
                    name: 'home',
                    component: () => import('../views/home/content.vue'),
                },
                {
                    path: '/select',
                    name: 'select',
                    component: () => import('../views/home/selectHome.vue'),
                },
                {
                    path: '/user',
                    name: 'user',
                    component: () => import('../views/home/user.vue'),
                    children: [
                        {
                            path: '/user',
                            redirect: '/user/userData'
                        },
                        {
                            path: '/user/userData',
                            name: 'uuserData',
                            component: () => import('../views/pc/userData/userData.vue'),
                        },
                        {
                            path: '/user/userLvek',
                            name: 'userLvek',
                            component: () => import('../views/pc/userData/userLvek.vue'),
                        },
                        {
                            path: '/user/collect',
                            name: 'collect',
                            component: () => import('../views/pc/userData/collect.vue'),
                        },
                        {
                            path: '/user/trade',
                            name: 'trade',
                            component: () => import('../views/pc/userData/trade.vue'),
                        }
                    ]
                }
            ]
        },
        {
            path: '/search',
            name: 'search',
            component: () => import('../views/search.vue')
        },
        {
            path: '/login',
            name: 'login',
            component: () => import('../views/login.vue')
        },
        {
            path: '/register',
            name: 'register',
            component: () => import('../views/register.vue'),
            children: [
                {
                    path: '/register',
                    redirect: '/register/reg'
                },
                {
                    path: '/register/reg',
                    name: 'reg',
                    component: () => import('../views/pc/reg/reg.vue'),
                },
                {
                    path: '/register/mailcode',
                    name: 'mailcode',
                    component: () => import('../views/pc/reg/mailcode.vue'),
                },
                {
                    path: '/register/goHome',
                    name: 'goHome',
                    component: () => import('../views/pc/reg/goHome.vue'),
                },
            ]
        },
        {
            path: '/upPassword',
            name: 'upPassword',
            component: () => import('../views/upPassword.vue')
        },
        {
            path: '/ThisSelect',
            name: 'ThisSelect',
            component: () => import('../views/ThisSelect.vue')
        },
        {
            path: '/ThisData',
            name: 'ThisData',
            component: () => import('../views/ThisData.vue')
        },
        {
            path: '/detailsPage',
            name: 'detailsPage',
            component: () => import('../views/detailsPage.vue')
        },
        {
            path: '/userData',
            name: 'userData',
            component: () => import('../views/userData.vue')
        },
        {
            path: '/Buy',
            name: 'Buy',
            component: () => import('../views/Buy.vue')
        },
        {
            path: '/iSalipay',
            name: 'iSalipay',
            component: () => import('../views/home/iSalipay.vue')
        },
    ],
    scrollBehavior() {
        return { top: 0 };
    }
})

export default router